/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package slicktemplate;

import java.util.ArrayList;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.Image;
import org.newdawn.slick.Input;
import org.newdawn.slick.state.StateBasedGame;

/**
 *
 * @author Josh
 */
public class WallSelect implements Renderable, Updateable {

    float x, y;
    public static final ArrayList<WallSelect> all = new ArrayList<WallSelect>();
    Image sprite;

    public WallSelect(float inx, float iny) {
        all.add(this);
        x = inx;
        y = iny;
        try {
            sprite = new Image("sprites/wall.png"); //try to load the sprite
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @Override
    public boolean update(Input input, StateBasedGame sb) {

        /*if (input.isMousePressed(input.MOUSE_LEFT_BUTTON) && isColliding(input.getMouseX(), input.getMouseY())) {
        //  new Wall(x, y);
        }*/

        return false;
    }

    public void render(Graphics g) {
        sprite.drawCentered((float) x, (float) y);
    }

    public boolean isColliding(double otherx, double othery) {
        if (otherx < x + sprite.getWidth() / 2 && otherx > x - sprite.getWidth() / 2 && othery > y - sprite.getHeight() / 2 && othery < y + sprite.getHeight() / 2) {
            return true;
        } else {
            return false;
        }
    }

    public String toString() {
        return "WallSelect";
    }

    public boolean mousePressed(Input input, StateBasedGame sb, int button) {
        return false;
    }

    public boolean mouseDown(Input input, StateBasedGame sb, int button) {
        return false;
    }

    public void mousePressed(StateBasedGame sb, int button) {
    }

    @Override
    public float getX() {
        return x;
    }

    @Override
    public float getY() {
        return y;
    }
}
